﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:MSAP.Framework.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d">
    <SolidColorBrush x:Key="TabItemDisabledBackground" Color="#F4F4F4"/>
	<SolidColorBrush x:Key="TabItemDisabledBorderBrush" Color="#FFC9C7BA"/>

    <ControlTemplate x:Key="CloseButton" TargetType="{x:Type Button}" >
    	<ControlTemplate.Resources>
    		<Storyboard x:Key="SbCloseTabEnter">
    			<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Ligne1" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
    				<SplineColorKeyFrame KeyTime="00:00:00" Value="#2175B8"/>
    			</ColorAnimationUsingKeyFrames>
    			<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Ligne2" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
    				<SplineColorKeyFrame KeyTime="00:00:00" Value="#2175B8"/>
    			</ColorAnimationUsingKeyFrames>
    		</Storyboard>
    		<Storyboard x:Key="SbCloseTabLeave">
    			<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Ligne1" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
    				<SplineColorKeyFrame KeyTime="00:00:01" Value="White"/>
    			</ColorAnimationUsingKeyFrames>
    			<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Ligne2" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
    				<SplineColorKeyFrame KeyTime="00:00:01" Value="White"/>
    			</ColorAnimationUsingKeyFrames>
    		</Storyboard>
    	</ControlTemplate.Resources>
    	    <Grid Width="15" Height="15" VerticalAlignment="Center">
    		    <Path Stretch="Fill" Stroke="#FF2175B8" Data="M14.5,7.5 C14.5,11.365993 11.365993,14.5 7.5,14.5 C3.6340068,14.5 0.5,11.365993 0.5,7.5 C0.5,3.6340068 3.6340068,0.5 7.5,0.5 C11.365993,0.5 14.5,3.6340068 14.5,7.5 z" d:LayoutOverrides="Width, Height" d:DesignWidth="15" d:DesignHeight="15" RenderTransformOrigin="0.5,0.5">
    			    <Path.RenderTransform>
    				    <TransformGroup>
    					    <ScaleTransform ScaleX="1" ScaleY="1"/>
    					    <SkewTransform/>
    					    <RotateTransform/>
    					    <TranslateTransform/>
    				    </TransformGroup>
    			    </Path.RenderTransform>
    			    <Path.Fill>
    				    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    					    <GradientStop Color="#FF2175B8" Offset="0"/>
    					    <GradientStop Color="White" Offset="1"/>
    				    </LinearGradientBrush>
    			    </Path.Fill>
    		    </Path>
    		    <Path x:Name="Ligne1" Fill="White" Stretch="Fill" Stroke="White" HorizontalAlignment="Stretch" Margin="4.5" Width="6" Data="M5.5,4.5833333 L9.75,11" RenderTransformOrigin="0.5,0.5" Height="6">
    			    <Path.RenderTransform>
    				    <TransformGroup>
    					    <ScaleTransform ScaleX="1" ScaleY="1"/>
    					    <SkewTransform/>
    					    <RotateTransform/>
    					    <TranslateTransform/>
    				    </TransformGroup>
    			    </Path.RenderTransform>
    		    </Path>
    		    <Path x:Name="Ligne2" Fill="White" Stretch="Fill" Stroke="White" HorizontalAlignment="Stretch" Margin="4.5" Width="6" Data="M5.5,4.5833333 L9.75,11" RenderTransformOrigin="0.5,0.5" Height="6">
    			<Path.RenderTransform>
    				<TransformGroup>
    					<ScaleTransform ScaleX="1" ScaleY="1"/>
    					<SkewTransform/>
    					<RotateTransform Angle="90"/>
    					<TranslateTransform/>
    				</TransformGroup>
    			</Path.RenderTransform>
    		</Path>
    	    </Grid>
        <ControlTemplate.Triggers>
            <EventTrigger RoutedEvent="Mouse.MouseEnter" >
                <BeginStoryboard Storyboard="{StaticResource SbCloseTabEnter}"/>
            </EventTrigger>
            <EventTrigger RoutedEvent="Mouse.MouseLeave" >
                <BeginStoryboard Storyboard="{StaticResource SbCloseTabLeave}" />
            </EventTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <DataTemplate x:Key="TabHeaderDataTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock x:Name="textBlock" 
                Text="{Binding Header}" 
                HorizontalAlignment="Left" TextTrimming="CharacterEllipsis" 
                TextWrapping="NoWrap" Foreground="#FFFFFFFF" Margin="0,2,0,0"  
                FontFamily="Arial" FontSize="11" >
                <TextBlock.Background>
                    <RadialGradientBrush>
                        <GradientStop Color="#A3FFFFFF" Offset="0"/>
                        <GradientStop Color="#00FFFFFF" Offset="1"/>
                    </RadialGradientBrush>
                </TextBlock.Background>
            </TextBlock> 
            <Button x:Name="button" Grid.Column="1" Grid.Row="0" Template="{StaticResource CloseButton}" OverridesDefaultStyle="True"
                Command="{Binding CloseCommand}" 
                BorderBrush="{x:Null}" Foreground="{x:Null}" 
                ToolTip="Close" 
                VerticalAlignment="Center" BorderThickness="0"
                HorizontalAlignment="Center" />
        </StackPanel>
    </DataTemplate>
    
    <Style x:Key="ShellTabItemStyle" TargetType="Controls:AnimatedTabItem" > <!--TargetType="{x:Type TabItem}"-->
		<Setter Property="FontFamily" Value="Trebuchet MS"/>
		<Setter Property="FontSize" Value="14"/>
		<Setter Property="Foreground" Value="#FFFFFFFF"/>
        <!--<Setter Property="HeaderTemplate" Value="{DynamicResource TabHeaderDataTemplate}" />-->
        <Setter Property="Header" Value="{Binding Content.DataContext.Title, RelativeSource={RelativeSource Self}}" />
        <!--<Setter Property="Header" Value="{Binding Content.DataContext.HeaderInfo, RelativeSource={RelativeSource Self}}" />-->
        <Setter Property="Template">
			<Setter.Value>
                <ControlTemplate TargetType="Controls:AnimatedTabItem">
                    <Grid  x:Name="TabItemRoot" Margin="10,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition  MaxWidth="15" SharedSizeGroup="btnCloseTab"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="15" />
                        </Grid.RowDefinitions>
                        <TextBlock x:Name="textBlock" 
                            Text="{TemplateBinding Header}" Grid.Column="0" Grid.Row="0"
                            HorizontalAlignment="Center" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" 
                            TextWrapping="NoWrap" Foreground="#FFFFFFFF" Margin="0,0,5,0"  
                            FontFamily="Arial" FontSize="11" >
                            <TextBlock.Background>
                                <RadialGradientBrush>
                                    <GradientStop Color="#A3FFFFFF" Offset="0"/>
                                    <GradientStop Color="#00FFFFFF" Offset="1"/>
                                </RadialGradientBrush>
                            </TextBlock.Background>
                        </TextBlock>
                        <Button x:Name="btnCloseTab" Grid.Column="1" Grid.Row="0" Template="{StaticResource CloseButton}" OverridesDefaultStyle="True"
				                Command="{TemplateBinding CloseCommand}" 
				                BorderBrush="{x:Null}" Foreground="{x:Null}" 
				                VerticalAlignment="Center" BorderThickness="0"
				                HorizontalAlignment="Center" ToolTip="Fermer l'onglet" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsDefault" Value="true">
                            <Setter TargetName="btnCloseTab" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter TargetName="textBlock" Property="Opacity" Value="1"/>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="false">
                            <Setter TargetName="textBlock" Property="Opacity" Value="0.5"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>